package com.lfx.concurrent.queue;

import java.util.Random;

/**
 * @author 李逢喜
 * create 2021/7/22
 */
public class ConsumerThread extends Thread{
    private final MyQueue myQueue;

    private final Random random=new Random();

    public ConsumerThread(MyQueue myQueue){
        this.myQueue=myQueue;
    }

    @Override
    public void run() {
       while (true){
           String s = myQueue.get();
           System.out.println("取到数据:"+s);
//           try {
//               Thread.sleep(random.nextInt(1000));
//           } catch (InterruptedException e) {
//               e.printStackTrace();
//           }
       }
    }
}
